package guet.dream.db;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class DatabaseUtils {
	public static Connection con = null;

	public static Connection getConnection() {
		String driver = "com.mysql.jdbc.Driver";
		String username = "guet";
		String password = "08003";
		String url="jdbc:mysql://localhost:3306/dream?useUnicode=true&amp;characterEncoding=UTF-8";
		if(con != null){
			return con;
		}else{
			try {
				Class.forName(driver);
			
					con = DriverManager.getConnection(url, username, password);
		
			} catch (ClassNotFoundException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}catch (SQLException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
			}
			
		}
		return con;
	}


}
